﻿@model thailandProject.Models.TASKTYPE

@{
    ViewBag.Title = "Edit Task Type";
}

<div id="Wrapper2">
    <div id="content_header">
        <div id="headerimage">
        </div>
        <div id="theheader">@ViewBag.Header</div>
    </div>
    <!-- Left Column begins here -->
    <aside id="sidebar-wrapper">
        <nav class="sidebar">
            <!-- CONTENT GOES HERE -->

    @using (Html.BeginForm("EditTaskType", "Admin", FormMethod.Post, new { id = "editForm" }))
    {
        <div class="display-label">Task Type Name</div>
        <div class="display-field">
            <input type="hidden" id="taskTypeID" name="taskTypeID" value="@Model.taskTypeID" />
            <input type="text" id="taskTypeName" name="taskTypeName" maxlength="50" value="@Model.taskTypeName" />
            <div id="taskTypeNameError" style="color:red; visibility:hidden">Task type name must not be empty</div>
        </div>
        <div class="display-label">Is Active</div>
        <div class="display-field">
            <input type="checkbox" name="isActive" @if(Model.isActive.HasValue && Model.isActive.Value) { @:checked="checked"
            } />
        </div>

        <div class="formButtons">
            <input type="image" src="../../images/save_button.png" id="editTaskTypeButton" value="Edit Task" />
            <div id="formError" style="color:red; visibility:hidden">Please fix the above errors to continue</div>
        </div>
    }

<p>
    @Html.ActionLink("Back", "ManageTaskTypes")
</p>

            
        </nav>
    </aside>
    <!-- Right column begins here -->
    <article id="contents">
        
    </article>
    <!-- Right column ends here -->
</div>
<!-- Div wrapper2 ends here -->

<script type = "text/javascript">
    $("#editForm").submit(function () {

        if ($("#taskTypeName").val() == "") {
            $("#taskTypeNameError").attr('style', 'color:red; visibility:visible;');
            $("#formError").attr('style', 'color:red; visibility:visible;');
            $("#taskTypeName").focus();
            return false;
        }
        else {
            $("#taskTypeNameError").attr('style', 'color:red; visibility:hidden;');
            $("#formError").attr('style', 'color:red; visibility:hidden;');
            return true;
        }
    })
</script>